Skip to content

Fully annotate Field.formfield keyword args#3443

Open
brianhelba wants to merge 1 commit into
typeddjango:masterfrom
brianhelba:formfield
Open

Fully annotate Field.formfield keyword args#3443
brianhelba wants to merge 1 commit into
typeddjango:masterfrom
brianhelba:formfield

Conversation

@brianhelba

@brianhelba brianhelba commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This follows the suggestion by @intgr in https://github.com/typeddjango/django-stubs/pull/1778/changes#r1365630425

The removed methods have the exact same signature as the base class. Remaining subclass methods clearly note which extra parameters are added to distinguish them.

AI Policy

  • I have read and agree to the AI Policy, removed any "Co-Authored-By" lines attributing coding agents, and manually reviewed the final result

@brianhelba brianhelba marked this pull request as draft June 23, 2026 04:15
@brianhelba brianhelba force-pushed the formfield branch 2 times, most recently from 06942f7 to e721d02 Compare June 23, 2026 04:32
srid: Any = ...,
**kwargs: Any,
) -> forms.GeometryField: ...
) -> forms.GeometryField | None: ...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like the base class, subclasses of this are allowed to return None, even though this particular method doesn't.

Comment on lines +240 to +242
# The parameters form_class / choices_form_class are positional at runtime, but
# usage and docs always pass them as keyword args; additionally, all subclasses
# require them to be keyword-only, so require all usage to be keyword-only.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth noting.

@brianhelba brianhelba marked this pull request as ready for review June 23, 2026 04:49

@sobolevn sobolevn left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CC @intgr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants